package api

import (
	"github.com/gogf/gf/net/ghttp"
	"github.com/google/uuid"
	"github.com/zhang201702/zhang"
)

type CertApi struct {
	BaseApi
}

func init()  {
	registerApi("cert", func(name string) Api {
		api := &CertApi{BaseApi:*NewBaseApi(name,name)}
		return api
	})
}
func (api *CertApi) Register(s *zhang.ServerGF) {
	api.BaseApi.Register(s)
	s.BindHandler("/cert/upload", api.fontUpload)
}

func (api *CertApi) fontUpload(r *ghttp.Request) {
	_, path := uploadFile(r, "/img/cert/")
	if path != "" {
		/// name := r.GetString("name")
		//cert := g.Map{"name": name, "path": path}
		//_, err := api.service.Insert(font)
		path = path + "?" + uuid.New().String()
		api.Result(path, nil, r)
	}
}
